package supercafe.core;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

public class MenuType implements Parcelable {
	private int typeId;
	private String typeName;
	private List<MenuItem> items;
	public MenuType(){
		typeId = -1;
		typeName = "new type";
		items = new ArrayList<MenuItem>();
	}
	public MenuType(int id, String name, List<MenuItem> items){
		typeId = id;
		typeName = name;
		this.items = items;
	}
	public int getTypeId(){
		return this.typeId;
	}
	public String getTypeName(){
		return this.typeName;
	}
	public List<MenuItem> getMenuItems(){
		return this.items;
	}
	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return typeId;
	}
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub
		dest.writeInt(typeId);
		dest.writeString(typeName);
		dest.writeTypedList(items);
	}
	
	public static final Parcelable.Creator<MenuType> CREATOR = new Parcelable.Creator<MenuType>() {
        public MenuType createFromParcel(Parcel in) {
            return new MenuType(in);
        }

        public MenuType[] newArray(int size) {
            return new MenuType[size];
        }
    };

    private MenuType(Parcel in) {
    	this();
    	typeId = in.readInt();
    	typeName = in.readString();
    	in.readTypedList(items, MenuItem.CREATOR);
    }
}
